/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.aptech.entities;

import java.io.Serializable;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author Winner
 */
@Entity
@Table(name = "tblProjectDetail")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "TblProjectDetail.findAll", query = "SELECT t FROM TblProjectDetail t"),
    @NamedQuery(name = "TblProjectDetail.findByPrID", query = "SELECT t FROM TblProjectDetail t WHERE t.tblProjectDetailPK.prID = :prID"),
    @NamedQuery(name = "TblProjectDetail.findByElID", query = "SELECT t FROM TblProjectDetail t WHERE t.tblProjectDetailPK.elID = :elID"),
    @NamedQuery(name = "TblProjectDetail.findByPdNo", query = "SELECT t FROM TblProjectDetail t WHERE t.tblProjectDetailPK.pdNo = :pdNo")
})
public class TblProjectDetail implements Serializable {

    private static final long serialVersionUID = 1L;
    @EmbeddedId
    protected TblProjectDetailPK tblProjectDetailPK;
    @JoinColumn(name = "wkID", referencedColumnName = "wkID")
    @ManyToOne
    private TblWorking wkID;
    @JoinColumn(name = "prID", referencedColumnName = "prID", insertable = false, updatable = false)
    @ManyToOne(optional = false)
    private TblProject tblProject;
    @JoinColumn(name = "elID", referencedColumnName = "elID", insertable = false, updatable = false)
    @ManyToOne(optional = false)
    private TblElevation tblElevation;

    public TblProjectDetail() {
    }

    public TblProjectDetail(TblProjectDetailPK tblProjectDetailPK) {
        this.tblProjectDetailPK = tblProjectDetailPK;
    }

    public TblProjectDetail(int prID, int elID,int pdNo) {
        this.tblProjectDetailPK = new TblProjectDetailPK(prID, elID, pdNo);
    }

    public TblProjectDetailPK getTblProjectDetailPK() {
        return tblProjectDetailPK;
    }

    public void setTblProjectDetailPK(TblProjectDetailPK tblProjectDetailPK) {
        this.tblProjectDetailPK = tblProjectDetailPK;
    }

    public TblWorking getWkID() {
        return wkID;
    }

    public void setWkID(TblWorking wkID) {
        this.wkID = wkID;
    }

    public TblProject getTblProject() {
        return tblProject;
    }

    public void setTblProject(TblProject tblProject) {
        this.tblProject = tblProject;
    }

    public TblElevation getTblElevation() {
        return tblElevation;
    }

    public void setTblElevation(TblElevation tblElevation) {
        this.tblElevation = tblElevation;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (tblProjectDetailPK != null ? tblProjectDetailPK.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof TblProjectDetail)) {
            return false;
        }
        TblProjectDetail other = (TblProjectDetail) object;
        if ((this.tblProjectDetailPK == null && other.tblProjectDetailPK != null) || (this.tblProjectDetailPK != null && !this.tblProjectDetailPK.equals(other.tblProjectDetailPK))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.aptech.entities.TblProjectDetail[ tblProjectDetailPK=" + tblProjectDetailPK + " ]";
    }
}
